import Vue from 'vue'
import VueRouter from 'vue-router'

// 采用懒加载的方式引入组件
const index = () => import('../pages/index'); //主页
const mineMiusc = () => import('../pages/mineMusic')//我的音乐
//1.安装插件
Vue.use(VueRouter);

//2.创建路由对象
const routes = [
  {
    path: '/index',
    component: index
  },
  {
    path: '/minemiusc',
    component: mineMiusc
  },
  {
    path: '/*',
    redirect: '/index'
  }//当所有路由不匹配时跳到index
  
]
const router = new VueRouter({
  routes,
  mode: "history"
})

//3.导出router
export default router
